package io.gitee.kotle.demo.doc

import io.gitee.kotle.android.delegate.unsafeLazy
import io.gitee.kotle.android.mvvm.MvvmViewModel
import io.gitee.kotle.android.utils.awaitHttp
import io.gitee.kotle.android.utils.createStatusLiveData

class DemoViewModel : MvvmViewModel() {
    /**
     * 暴露图片的加载结果
     */
    val picData by unsafeLazy { createStatusLiveData<List<DemoBean>>() }

    /**
     * 加载图片
     */
    fun loadPic() {
        picData.runOnScope {
            "https://tupian.com".awaitHttp()
        }
    }
}